// 上下左右移动

cc.Class({
    extends: cc.Component,

    properties: {
        m_move:true,
    },

    onLoad () {

    },

    // 上移动
    RoomAnimateAndUp : function() {
        if (!this.m_move) {
            return;
        }
        this.m_move = false;
        var downBtn = this.node.getChildByName("downBtn");
        var upBtn = this.node.getChildByName("upBtn");

        var btnMove = cc.moveBy(0.5, cc.p(this.node.width, this.node.height + 130));
        var callFunc = cc.callFunc(()=>{
            this.m_move = true;
            downBtn.active = true;
            upBtn.active = false;
        });

        this.node.runAction(cc.sequence(btnMove, callFunc));
    },

    // 下移动
    RoomAnimateAndDown : function() {
        if (!this.m_move) {
            return;
        }
        this.m_move = false;
        var downBtn = this.node.getChildByName("downBtn");
        var upBtn = this.node.getChildByName("upBtn");

        var btnMove = cc.moveBy(0.5, cc.p(this.node.width, this.node.height - 130));
        var callFunc = cc.callFunc(()=>{
            this.m_move = true;
            downBtn.active = false;
            upBtn.active = true;
        });

        this.node.runAction(cc.sequence(btnMove, callFunc));
    },

    // 左移动
    AnimateAndLeft : function() {
        if (!this.m_move) {
            return;
        }


    },

    // 右移动
    AnimateAndRight : function() {
        if (!this.m_move) {
            return;
        }


    },
});
